package com.yangzhe.happyreader;

import android.content.Intent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yangzhe.base.base.AppActivity;
import com.yangzhe.base.router.base.RounterBus;
import com.yangzhe.base.router.reader.ReaderMainActivity;
import com.yangzhe.interview.ui.fragment.InterViewFragment;
import com.yangzhe.recreation.ui.fragment.RecreationFragment;

public class MainActivity extends AppActivity {

    TextView mTxtToolbarCenter;
    FrameLayout mFlayoutMain;
    TextView mTxtReader;
    TextView mTxtRecreation;
    TextView mTxtInterview;
    LinearLayout mLlayoutMainBottom;


    @Override
    protected void initView() {
        mTxtToolbarCenter = (TextView) findViewById(R.id.txt_toolbar_center);
        mFlayoutMain = (FrameLayout) findViewById(R.id.flayout_main);
        mTxtReader = (TextView) findViewById(R.id.txt_reader);
        mTxtRecreation = (TextView) findViewById(R.id.txt_recreation);
        mTxtInterview = (TextView) findViewById(R.id.txt_interview);
        mLlayoutMainBottom = (LinearLayout) findViewById(R.id.llayout_main_bottom);

    }

    @Override
    protected void initListenter() {
        mTxtReader.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = RounterBus.getRounter(ReaderMainActivity.class).toReaderMainAcitivity("heihei");
                if (intent != null) {
                    MainActivity.this.startActivity(intent);
                }
            }
        });
        mTxtRecreation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                addFragment(RecreationFragment.newInstance());
            }
        });
        mTxtInterview.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                addFragment(InterViewFragment.newInstance());
            }
        });
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_main;
    }

    @Override
    protected int getFragmentContentId() {
        return R.id.flayout_main;
    }


}
